package RJ;

import java.util.ArrayList;

public class Group {
	
	String name;
	private Person GroupManager;
	Person GroupHead;
	ArrayList<Person> groupMember;
	
	public Person getGroupHead() {
		return GroupHead;
	}
	public void setGroupHead(Person groupHead) {
		GroupHead = groupHead;
	}
	public Group(String name){
		this.name=name;
		this.groupMember = new ArrayList<Person>();
	}
	@Override
	public String toString(){
		
		String s = "";
		s += String.format("group(%s)\n", this.name);
		if(GroupHead!=null)	s += String.format("heads-group(%s, %s)\n", GroupHead.name,this.name);
		String t = "";
		s+= String.format("Group Manager(%s,%s)\n", this.getGroupManager().getName(),this.name);
		String q  = "";
		for(Person p:groupMember)	q+=p.getName() + ", ";
		if(q.length()>2)	q = q.substring(0,q.length()-2);
		q = String.format("Group Member(%s, {%s})", this.name,q);
		s+=q;
		return s;		
	}
	public Person getGroupManager() {
		return GroupManager;
	}
	void setGroupManager(Person groupManager) {
		this.GroupManager = groupManager;
	}
}
